<?php
include('rootlogin.php');
//include('../../incsession.php');
session_start();


mysql_query("SET NAMES 'utf8'");
if(!isset($_POST['sys_intro1']) || !isset($_POST['sys_intro2']) || !isset($_POST['sys_intro3'])){
			$flag=0;
}
else if($_POST['sys_intro1'] == '' || $_POST['sys_intro1'] == ' ' ||
		$_POST['sys_intro2'] == '' || $_POST['sys_intro2'] == ' ' ||
		$_POST['sys_intro3'] == '' || $_POST['sys_intro3'] == ' '){
			$flag=1;	
}
else{
	$one = str_replace("'", "&#39;", $_POST['sys_intro1']);
	$one = str_replace('"', '&quot;', $one);
	$two = str_replace("'", "&#39;", $_POST['sys_intro2']);
	$two = str_replace('"', '&quot;', $two);
	$three = str_replace("'", "&#39;", $_POST['sys_intro3']);
	$three = str_replace('"', '&quot;', $three);
	$query = "UPDATE system SET sys_intro1='".$one."',
								sys_intro2='".$two."',
								sys_intro3='".$three."'";
	$result = mysql_query($query,$user_con) or die('<font color="#C11B17">Error. Please go back to the previous page and try again.</font>');	
	header ("location: ../index.php");
}
?>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../framestyle.css" type="text/css" media="screen">
</head>

<body>
<div id="wrapper">
<div id="title">Online Listening Comprehension Program</div>

<div id="main">
<hr/>
<div id="title2">INTRO TO THE PROGRAM</div>
<hr/>
<br><br>
<?php
	if($flag==1){
		echo "<div id='error'>Please fill in all the column.</div><br>";
	}
?>
<form method = POST action="sys_intro.php" >


<?php
	$query="SELECT * FROM system";
	$result = mysql_query($query,$user_con);
	$row = mysql_fetch_array($result);
	echo "Description:<br>";
	echo '<textarea name="sys_intro1" rows=12 cols=110>'.$row['sys_intro1'].'</textarea><br><br>';
	echo "Ten Steps:<br>"; 
	echo '<textarea name="sys_intro2" rows=12 cols=110>'.$row['sys_intro2'].'</textarea><br><br>';
	echo "Tidbits about Pro-active, Responsible Learning:<br>"; 
	echo '<textarea name="sys_intro3" rows=12 cols=110>'.$row['sys_intro3'].'</textarea><br><br>';
?>
<br><br>
<div class="btn_right"><input type="submit" name = "next" value = "submit"></div>

</form>


</div>
</div>

</body>

